package com.moliku.insurance.model.dto;

import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * MQ 消息DTO
 *
 * @author Mr.Liu
 * @since 2021/2/25
 */
@Data
@NoArgsConstructor
public class MessageDTO implements Serializable {
    private static final long serialVersionUID = 9088800019712840327L;
    /**
     * 公司编码
     */
    private String company;
    /**
     * 数据(JSON)
     */
    private String data;

    public MessageDTO(String company, Object data) {
        this.company = company;
        if (data != null) {
            this.setData(JSONObject.toJSONString(data));
        }
    }
}
